// pages/home/studentHome/studentHome.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
		swiperList: [
			{
				id: 'x001',
				imgUrl: '/images/home-swiper.png',
			},
			{
				id: 'x002',
				imgUrl: '/images/home-swiper.png'
			}
		],
		newList: [
			{
				"newsId": "n001",
				"title": "关于开设外卖柜决定",
				"publisher": "YM",
				"pub_date": "number",
				"coverImgUrl": "string"
			},
			{
				"newsId": "n001",
				"title": "新规章：禁止用洗衣机洗内裤和袜子",
				"publisher": "YM",
				"pub_date": "number",
				"coverImgUrl": "string"
			},
      {
        "newsId": "n003",
				"title": "关于开除决定",
				"publisher": "校长",
				"pub_date": "number",
				"coverImgUrl": "string"
      }
		],
		infoList: [
			{
				"newsId": "i001",
				"title": "期末考试安排通知",
				"publisher": "教务处",
				"pub_date": "number",
				"coverImgUrl": "string"
			},
			{
				"newsId": "i002",
				"title": "奖学金申请截止日期延长",
				"publisher": "学生处",
				"pub_date": "number",
				"coverImgUrl": "string"
			},
      {
        "newsId": "i003",
				"title": "校园安全检查通知",
				"publisher": "保卫处",
				"pub_date": "number",
				"coverImgUrl": "string"
      },
      {
        "newsId": "i004",
				"title": "新生报到流程须知",
				"publisher": "招生办",
				"pub_date": "number",
				"coverImgUrl": "string"
      }
		],
		currentTab: 'news' // 'news' 表示金审新闻，'info' 表示通知公告
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
      this.getTabBar().setData({
        selected: 0
      })
    }
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

	},
	
	navToSearch() {
		wx.navigateTo({
			url: '/pages/search/search',
		})
	},
  
  /**
   * 切换标签
   */
  switchTab(e) {
    const tab = e.currentTarget.dataset.tab;
    this.setData({
      currentTab: tab
    });
	},
	
	navToAi() {
		console.log(111)
		wx.navigateTo({
			url: '/pages/ask/ask',
		})
	},

	navToSearchList() {
		wx.navigateTo({
			url: '/pages/search/searchList',
		})
	}
})